<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateTableMaterial extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function up()
    {
        $this->execute("CREATE TABLE `f_material` (
            `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
            `media_id` varchar(245) DEFAULT NULL,
            `type` varchar(45) DEFAULT NULL COMMENT '素材类型',
            `title` varchar(45) DEFAULT NULL COMMENT '标题',
            `url` varchar(145) DEFAULT NULL COMMENT '图文消息内的图片地址',
            `author` varchar(45) DEFAULT NULL COMMENT '作者',
            `digest` varchar(45) DEFAULT NULL COMMENT '摘要',
            `show_cover` int(1) DEFAULT NULL COMMENT '是否显示封面：0-不现实，1-显示',
            `thumb_media_id` varchar(245) DEFAULT NULL COMMENT '封面图片永久ID',
            `content` text COMMENT '正文内容',
            `content_source_url` varchar(145) DEFAULT NULL COMMENT '阅读全文地址',
            `need_open_comment` int(1) DEFAULT NULL COMMENT '是否打开评论，0不打开，1打开',
            `only_fans_can_comment` int(1) DEFAULT NULL COMMENT '是否粉丝才可评论，0所有人可评论，1粉丝才可评论',
            `video_ introduction` varchar(145) DEFAULT NULL COMMENT '视频描述信息',
            `local_path` varchar(245) DEFAULT NULL,
            `local_url` varchar(245) DEFAULT NULL,
            `upload_status` varchar(45) DEFAULT '这' COMMENT '上传状态',
            `create_time` int(10) DEFAULT NULL,
            `update_time` int(10) DEFAULT NULL,
            `msg_id` varchar(64) DEFAULT NULL COMMENT '消息id',
            `msg_data_id` varchar(64) DEFAULT NULL COMMENT '消息数据id',
            `send_status` varchar(45) DEFAULT 'normal' COMMENT '发送状态',
            `send_time` int(11) DEFAULT NULL COMMENT '发送时间',
            `send_to` varchar(45) DEFAULT 'null' COMMENT '发送对象',
            PRIMARY KEY (`id`)
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='素材表';");
    }
    public function down()
    {
        $this->execute("");
    }
}
